//
//  OSUser.m
//  OSChina
//
//  Created by 林涛 on 15/1/6.
//  Copyright (c) 2015年 林涛. All rights reserved.
//


#import "OSUser.h"
static NSString *kOSUserKey = @"OS_USER_DEFAULTSs";

@interface OSUser()
@property (nonatomic, strong)NSDictionary *user;
@property (nonatomic, strong)NSDictionary *notice;
@end
@implementation OSUser

- (id)initWithDic:(NSDictionary *)dic
{
    self = [super init];
    self.user = dic;
    return self;
}

+ (BOOL)saveUser:(NSDictionary *)user
{
    NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
    [defaults setObject:user forKey:kOSUserKey];
    return [defaults synchronize];
}

- (NSDictionary *)notice
{
    NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
    return  [defaults valueForKey:kOSUserKey][@"notice"];
}

- (NSDictionary *)user
{
    NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
    return  [defaults valueForKey:kOSUserKey][@"user"];
}

- (NSString *)userName
{
    NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
    return  [defaults valueForKey:kOSUserKey][@"userName"];
}

- (NSString *)password
{
    NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
    return  [defaults valueForKey:kOSUserKey][@"password"];
}

- (NSString *)fans
{
    return [self user][@"fans"];
}

- (NSString *)favoritecount
{
    return [self user][@"favoritecount"];
}

- (NSString *)followers
{
    return [self user][@"followers"];
}

- (NSString *)gender
{
    return [self user][@"gender"];
}

- (NSString *)location
{
    return [self user][@"location"];
}

- (NSString *)name
{
    return [self user][@"name"];
}

- (NSString *)portrait
{
   return [self user][@"portrait"];
}

- (NSString *)score
{
    return [self user][@"score"];
}

- (NSString *)uid
{
    return [self user][@"uid"];
}

- (NSInteger)atmeCount
{
    return [[self.notice objectForKey:@"atmeCount"] integerValue];
}

- (NSInteger)msgCount
{
    return [[self.notice objectForKey:@"msgCount"] integerValue];
}

- (NSInteger)newFansCount
{
    return [[self.notice objectForKey:@"newFansCount"] integerValue];
}

- (NSInteger)reviewCount
{
    return [[self.notice objectForKey:@"reviewCount"] integerValue];
}
@end
